<?php
/***************************************************************************
 *
 *   copyright            : (C) 2011 Winds of Storm
 *
 *   $Id: showfile.php 155 2011-06-20 16:01:58Z stormerider $
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

require_once("../config.php");
$skip_header    = 1;
require_once($libdir . "init." . $phpEx);
require_once($libdir . "chat_functs." . $phpEx);
require_once($libdir . "admin." . $phpEx);

if (eregi("/", $_REQUEST['fname'])) {
    print("Error parsing file name, directory separators not allowed.");
    exit;
}

$fname  = "$basedir/cache/{$_REQUEST['fname']}";
$fsize  = filesize($fname);

Header("Content-type: application/octet-stream");
Header("Content-disposition: filename=\"{$_REQUEST['fname']}\"");
Header("Cache-control: private");
Header("Content-length: $fsize");

readfile($fname);
